/* arch/i386/init/head.S 
 * 
 * This file is part of xnix. 
 * 
 * XNIX is free software: you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation, either version 3 of the License, or 
 * (at your option) any later version. 
 * 
 * XNIX is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
 * GNU General Public License for more details. 
 * 
 * You should have received a copy of the GNU General Public License 
 * along with XNIX. If not, see <https://www.gnu.org/licenses/>
 */ 




.code32


.globl _start

_start:
	/* we are now in the protected-mode, just 
	 * do some initializes, and call main */
	lgdt gdt_descr

	movl $0xc0000000, %eax
	leal 1f, %ecx

	orl %ecx, %eax

	pushl %eax

	movl $0xc0000000, %eax
	leal init, %ecx

	orl %ecx, %eax

	pushl %eax

	retl

1:	hlt
	jmp 1b


.data

.align 16

.globl gdt

gdt:	.long 0x00000000, 0x00000000
	.long 0x0000ffff, 0x00cf9a00
	.long 0x0000ffff, 0x00cf9200


.globl gdt_descr

gdt_descr:
	.word . - gdt
	.long gdt


